<?php
/**
 * Create By: PhpStorm
 * User: yihua
 * File: GetUserHistoryCoupon.php
 * Date: 2017/1/9
 * Time: 23:32
 */

namespace app\api\model\page\user;

use app\library\PageBase;
use app\api\model\dao\UserCoupon;
use think\Log;
use app\library\Error;

class GetUserHistoryCoupon extends PageBase
{
    private $objUserCouponModel;

    public function __construct()
    {
        parent::__construct();
        $this->objUserCouponModel = new UserCoupon();
    }

    public function excute($param)
    {
        $ret = $this->checkToken($param);
        if (false === $ret) {
            return $this->getRes(Error::ERR_NO_AUTH);
        }


        $arrCouponInfo = $this->objUserCouponModel->getHistoryCouponByUserid($this->user_id);
        if (false === $arrCouponInfo) {
            return $this->getRes(Error::ERR_SYS);
        }
        $this->data = $arrCouponInfo;
        return $this->getRes();

    }
}
